package myenterpriseappconsole;

import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import sessionbean.HelloBeanRemote;

public class MyEnterpriseAppConsole
{

    public static void main(String[] args) throws NamingException
    {
        HelloBeanRemote remote = lookupHelloBeanRemote();
        System.out.println(remote.getMessage());
    }

    private static HelloBeanRemote lookupHelloBeanRemote() throws NamingException
    {
        Properties pros = new Properties();
        pros.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.enterprise.naming.SerialInitContextFactory");
        pros.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
        pros.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
        
        InitialContext ic = new InitialContext(pros);
        HelloBeanRemote remote = (HelloBeanRemote) ic.lookup("java:global/HelloModule/HelloBean!sessionbean.HelloBeanRemote");
        return remote;
    }
}
